package cn.omisheep.au.core;

import lombok.Data;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;


/**
 * @author zhou xin chen  😊
 * 联系方式 qq:1269670415  email:xinchenzhou666@gmail.com
 */
@Slf4j
@Data
public class AuKey {

    private AuRsa.AuKeyPair auKeyPair;

    @SneakyThrows
    public void refreshKeyGroup() {
        auKeyPair = AuRsa.genKeyPair();
        log.info("auKeyPair => {}", auKeyPair);
    }

    @SneakyThrows
    public String decrypt(String encryptSource) {
        return AuRsa.decrypt(encryptSource, auKeyPair.getPrivateKey());
    }

    public String getPublicKeyString() {
        return auKeyPair.getPublicKey();
    }

    public String getPrivateKeyString() {
        return auKeyPair.getPrivateKey();
    }

}
